import csv

import pandas as pd
import numpy as np
import os

if __name__ == '__main__':
    speeds = []
    csv_file = pd.read_csv("csv_results/all.csv")
    csv_values = csv_file.values
    delta_prog = csv_values[1:, 1:] - csv_values[:-1, 1:]
    max_prog = np.max(delta_prog, axis=0)
    min_prog = np.min(delta_prog, axis=0)
    max_min = np.stack((max_prog, min_prog), axis=0)
    with open("csv_results/speeds.csv", "w", newline='', encoding="utf-8") as f:
        writer = csv.writer(f)
        writer.writerow(csv_file.columns[1:])
        writer.writerows(max_min)
